home *** CD-ROM | disk | FTP | other *** search
/ LineOne ISP Sign-Up 5 / LineOne.iso / assets / cxt / scripts / parentScripts.cst / 00078_onlineService parent.ls < prev    next >
Encoding:
Text File  |  2001-01-27  |  3.5 KB  |  124 lines

  1. -- 2000.03.19
  2. -- Clive Green <clivegreen@atlas.co.uk>
  3.  
  4. ------------------------------------------------------------------------------------------------------
  5.  
  6. -- url hyperlink access:
  7.  
  8. ------------------------------------------------------------------------------------------------------
  9.  
  10. -- declare properties:
  11. property main              -- main code directory object
  12. property DUNbindings       -- a list of binding IDs which resolve to DUN dependent methods
  13.  
  14. ------------------------------------------------------------------------------------------------------
  15.  
  16. on new me,L
  17.   
  18.   -- (1) extract and check arguments:
  19.   
  20.   -- check for a parameter list:
  21.   if ilk(L) <> #propList then return [#error:#noParamListSupplied, #msg:"onlineService:new"]
  22.   
  23.   -- a reference to the parent codebase is REQUIRED:
  24.   main = L[#main]
  25.   if (ilk(main) <> #instance) then return [#error:#noMainObjectSupplied, #msg:"onlineService:new"]
  26.   
  27.   --------------------
  28.   
  29.   -- pull the list of known DUN bindings:
  30.   dm = main.getDataManager()
  31.   DUNbindings = dm.getData([#set:#settings,#item:#DUNbindings])
  32.   
  33.   -- pass back my address:
  34.   return me
  35.   
  36.   ----------------------------------------------------------------------------------------------------
  37.   
  38. on DUNbindingAvailable me,b
  39.   
  40.   -- is the bindingID b even listed as DUN-dependent?
  41.   if not getPos(DUNbindings,b) then return 1
  42.   
  43.   --------------------
  44.   
  45.   -- obtain conditions testing service:
  46.   sm = main.getServiceManager()
  47.   cs = sm.getService(#conditionsService)
  48.   
  49.   --------------------
  50.   
  51.   -- Dial up networking is simply assumed for the Mac version of the programme:
  52.   if cs.testCondition(#macintoshHost) then return 1
  53.   
  54.   -- the DUN test to be performed varies slightly according to the Win OS version being used:
  55.   if cs.testCondition(#windows95) then n = #DUNavailableWin95
  56.   else n = #DUNavailableWin
  57.    
  58.   -- so, is dial-up networking available for the current OS?
  59.   if cs.testCondition(n) then return 1
  60.   
  61.   --------------------
  62.   
  63.   -- this binding can't work:
  64.   return 0
  65.   
  66.   ----------------------------------------------------------------------------------------------------
  67.   
  68. on showHelp me
  69.   
  70.   -- show a platform-specific html frameSet:
  71.   um = main.getUtilityMethods()
  72.   p  = um.thePlatform()
  73.   
  74.   -- which help page?
  75.   f = symbol(p & "HelpURL") -- (ie: #pcHelpURL)
  76.   
  77.   --------------------
  78.   
  79.   -- obtain the (partial) filepath for the help page:
  80.   dm = main.getDataManager()
  81.   uL = dm.getData([#set:#filePaths,#item:f]) 
  82.   u  = uL[#filePath]
  83.   
  84.   -- the path u is given relative to the root directory of the projector/stub -
  85.   -- we need to prefix the filepath accordingly:
  86.   u = dm.getRootPath() & u
  87.    
  88.   -- attempt to display url; return the result to the caller:
  89.   return me.showURL([#url:u])
  90.   
  91.   ----------------------------------------------------------------------------------------------------
  92.   
  93. on showURL me,L
  94.   
  95.   -- need a list of parameters:
  96.   if ilk(L) <> #propList then return 0
  97.   
  98.   -- extract URL supplied:
  99.   url = L[#url]
  100.   if not stringP(url) then return 0
  101.   
  102.   --------------------
  103.   
  104.   -- parse the filePath for the current platform:
  105.   um = main.getUtilityMethods()
  106.   url = um.parseFilePath(url)
  107.   
  108.   --------------------
  109.   
  110.   -- background the projector layer:
  111.   xm = main.getXtrasManager()
  112.   bud = xm.getBuddyAPIxtra() 
  113.   if  (ilk(bud) <> #instance) then return bud
  114.   
  115.   bud.bkgndStage()
  116.   
  117.   --------------------
  118.   
  119.   -- display url's target using the host's currently selected browser application:
  120.   goToNetPage(url)
  121.   
  122.   return url
  123.   
  124.   ----------------------------------------------------------------------------------------------------